package com.webchat.rmi.pgc.mall;


import com.webchat.common.bean.APIResponseBean;
import com.webchat.domain.vo.request.mall.SaveMallCategoryRequestVO;
import com.webchat.domain.vo.response.mall.MallCategoryResponseVO;
import com.webchat.rmi.interceptor.RpcRequestInterceptor;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;

@FeignClient(name = "webchat-pgc-service",
        contextId = "mallCategoryClient",
        configuration = RpcRequestInterceptor.class)
public interface MallCategoryClient {


    /**
     * 创建或者更新商品分类
     *
     * @param requestVO
     * @return
     */
    @PostMapping("/pgc-service/mall/category/save")
    APIResponseBean<Long> save(@RequestBody SaveMallCategoryRequestVO requestVO);

    /**
     * 发布商品分类
     *
     * @param id
     * @param userId
     * @return
     */
    @PostMapping("/pgc-service/mall/category/publish/{id}/{userId}")
    APIResponseBean<Boolean> publish(@PathVariable Long id, @PathVariable String userId);

    /**
     * 撤回
     *
     * @param id
     * @param userId
     * @return
     */
    @PostMapping("/pgc-service/mall/category/invoke/{id}/{userId}")
    APIResponseBean<Boolean> invoke(@PathVariable Long id, @PathVariable String userId);

    /**
     * 删除
     *
     * @param id
     * @param userId
     * @return
     */
    @PostMapping("/pgc-service/mall/category/delete/{id}/{userId}")
    APIResponseBean<Boolean> delete(@PathVariable Long id, @PathVariable String userId);

    /**
     * 修改排序
     *
     * @param id
     * @param userId
     * @return
     */
    @PostMapping("/pgc-service/mall/category/updateRank/{id}/{rank}/{userId}")
    APIResponseBean<Boolean> updateRank(@PathVariable Long id,
                                     @PathVariable Integer rank,
                                     @PathVariable String userId);


    /**
     * 查询分类链接
     *
     * @return
     */
    @GetMapping("/pgc-service/mall/category/list")
    APIResponseBean<List<MallCategoryResponseVO>> list();

}
